/*
	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


if(!dojo._hasResource["dojo.parser"]){
dojo._hasResource["dojo.parser"]=true;
dojo.provide("dojo.parser");
dojo.require("dojo.date.stamp");
dojo.parser=new function(){
var d=dojo;
this._attrName=d._scopeName+"Type";
this._query="["+this._attrName+"]";
var _1=0,_2={};
var _3=function(_4,_5){
var _6=_5||_2;
if(dojo.isIE){
var cn=_4["__dojoNameCache"];
if(cn&&_6[cn]===_4){
return cn;
}
}
var _7;
do{
_7="__"+_1++;
}while(_7 in _6);
_6[_7]=_4;
return _7;
};
function _8(_9){
if(d.isString(_9)){
return "string";
}
if(typeof _9=="number"){
return "number";
}
if(typeof _9=="boolean"){
return "boolean";
}
if(d.isFunction(_9)){
return "function";
}
if(d.isArray(_9)){
return "array";
}
if(_9 instanceof Date){
return "date";
}
if(_9 instanceof d._Url){
return "url";
}
return "object";
};
function _a(_b,_c){
switch(_c){
case "string":
return _b;
case "number":
return _b.length?Number(_b):NaN;
case "boolean":
return typeof _b=="boolean"?_b:!(_b.toLowerCase()=="false");
case "function":
if(d.isFunction(_b)){
_b=_b.toString();
_b=d.trim(_b.substring(_b.indexOf("{")+1,_b.length-1));
}
try{
if(_b.search(/[^\w\.]+/i)!=-1){
_b=_3(new Function(_b),this);
}
return d.getObject(_b,false);
}
catch(e){
return new Function();
}
case "array":
return _b?_b.split(/\s*,\s*/):[];
case "date":
switch(_b){
case "":
return new Date("");
case "now":
return new Date();
default:
return d.date.stamp.fromISOString(_b);
}
case "url":
return d.baseUrl+_b;
default:
return d.fromJson(_b);
}
};
var _d={};
dojo.connect(dojo,"extend",function(){
_d={};
});
function _e(_f){
if(!_d[_f]){
var cls=d.getObject(_f);
if(!d.isFunction(cls)){
throw new Error("Could not load class '"+_f+"'. Did you spell the name correctly and use a full path, like 'dijit.form.Button'?");
}
var _10=cls.prototype;
var _11={},_12={};
for(var _13 in _10){
if(_13.charAt(0)=="_"){
continue;
}
if(_13 in _12){
continue;
}
var _14=_10[_13];
_11[_13]=_8(_14);
}
_d[_f]={cls:cls,params:_11};
}
return _d[_f];
};
this._functionFromScript=function(_15){
var _16="";
var _17="";
var _18=_15.getAttribute("args");
if(_18){
d.forEach(_18.split(/\s*,\s*/),function(_19,idx){
_16+="var "+_19+" = arguments["+idx+"]; ";
});
}
var _1a=_15.getAttribute("with");
if(_1a&&_1a.length){
d.forEach(_1a.split(/\s*,\s*/),function(_1b){
_16+="with("+_1b+"){";
_17+="}";
});
}
return new Function(_16+_15.innerHTML+_17);
};
this.instantiate=function(_1c,_1d,_1e){
var _1f=[],dp=dojo.parser;
_1d=_1d||{};
_1e=_1e||{};
d.forEach(_1c,function(_20){
if(!_20){
return;
}
var _21=dp._attrName in _1d?_1d[dp._attrName]:_20.getAttribute(dp._attrName);
if(!_21||!_21.length){
return;
}
var _22=_e(_21),_23=_22.cls,ps=_23._noScript||_23.prototype._noScript;
var _24={},_25=_20.attributes;
for(var _26 in _22.params){
var _27=_26 in _1d?{value:_1d[_26],specified:true}:_25.getNamedItem(_26);
if(!_27||(!_27.specified&&(!dojo.isIE||_26.toLowerCase()!="value"))){
continue;
}
var _28=_27.value;
switch(_26){
case "class":
_28="className" in _1d?_1d.className:_20.className;
break;
case "style":
_28="style" in _1d?_1d.style:(_20.style&&_20.style.cssText);
}
var _29=_22.params[_26];
if(typeof _28=="string"){
_24[_26]=_a(_28,_29);
}else{
_24[_26]=_28;
}
}
if(!ps){
var _2a=[],_2b=[];
d.query("> script[type^='dojo/']",_20).orphan().forEach(function(_2c){
var _2d=_2c.getAttribute("event"),_21=_2c.getAttribute("type"),nf=d.parser._functionFromScript(_2c);
if(_2d){
if(_21=="dojo/connect"){
_2a.push({event:_2d,func:nf});
}else{
_24[_2d]=nf;
}
}else{
_2b.push(nf);
}
});
}
var _2e=_23.markupFactory||_23.prototype&&_23.prototype.markupFactory;
var _2f=_2e?_2e(_24,_20,_23):new _23(_24,_20);
_1f.push(_2f);
var _30=_20.getAttribute("jsId");
if(_30){
d.setObject(_30,_2f);
}
if(!ps){
d.forEach(_2a,function(_31){
d.connect(_2f,_31.event,null,_31.func);
});
d.forEach(_2b,function(_32){
_32.call(_2f);
});
}
});
if(!_1d._started){
d.forEach(_1f,function(_33){
if(!_1e.noStart&&_33&&_33.startup&&!_33._started&&(!_33.getParent||!_33.getParent())){
_33.startup();
}
});
}
return _1f;
};
this.parse=function(_34,_35){
var _36;
if(!_35&&_34&&_34.rootNode){
_35=_34;
_36=_35.rootNode;
}else{
_36=_34;
}
var _37=d.query(this._query,_36);
return this.instantiate(_37,null,_35);
};
}();
(function(){
var _38=function(){
if(dojo.config.parseOnLoad){
dojo.parser.parse();
}
};
if(dojo.exists("dijit.wai.onload")&&(dijit.wai.onload===dojo._loaders[0])){
dojo._loaders.splice(1,0,_38);
}else{
dojo._loaders.unshift(_38);
}
})();
}
